Saga<'TData, 'TState, 'TEvent>Type

PackageFCQRS
C#-friendly abstract base for a saga, the counterpart of the F# Saga definition. A concrete saga supplies SagaName, InitialData, Originator, StartsOn, Start, HandleEvent and ApplySideEffects; the base provides the wiring (Init/Factory) and the small transition DSL. TData is data the saga carries in every state, TState its states, and TEvent the event type of the originator, the aggregate whose stored event starts the saga. Designed to be subclassed from C#.

Specification

Kind
Type
Members
18
Examples
0
``.ctor``Signature
Saga()
ApplySideEffectsSignature
this.ApplySideEffects
FactorySignature
this.Factory
FactorySignature
this.Factory
HandleEventSignature
this.HandleEvent

Summary

NameSignatureSynopsis
``.ctor``Saga()No description available.
ApplySideEffectsthis.ApplySideEffectsReturns the transition and commands for a stored state.
Factorythis.FactoryThe factory the saga-starter spawns instances from.
Factorythis.FactoryThe factory the saga-starter spawns instances from, with an explicit policy.
HandleEventthis.HandleEventHandles a message once the saga has a state: events from the aggregates it sends commands to, ExpectationExhausted, and the saga's own ToSelf messages.
Initthis.InitRegister the saga; calling this IS the registration.
Initthis.InitRegister the saga with an explicit (already-resolved) snapshot policy.
Startthis.StartHandles a message that arrives before the saga has a state: normally the event that started it.
StartsOnthis.StartsOnWhether a stored originator event starts an instance of this saga.
Originatorthis.OriginatorThe aggregate whose stored event starts the saga, and the target of ToOriginator.
SnapshotPolicythis.SnapshotPolicyPer-saga snapshot cadence.
SagaNamethis.SagaNameThe saga's stored name, like an aggregate's EntityName.
InitialDatathis.InitialDataNo description available.
NextStateSaga.NextState(next)No description available.
StateChangedSaga.StateChanged(next)Transition and event DSL over TState.
StaySaga.Stay()No description available.
StopSagaSaga.StopSaga()No description available.
UnhandledSaga.Unhandled()No description available.

``.ctor``

Saga()
Member

Returns

Saga<'TData, 'TState, 'TEvent>

ApplySideEffects

this.ApplySideEffects
Member
Returns the transition and commands for a stored state. It runs again after recovery; the bool says whether the saga is recovering.

Parameters

NameTypeDescription
arg0SagaState<'TData, 'TState>
arg1bool

Returns

SagaSideEffectResult<'TState>

Factory

this.Factory
Member
The factory the saga-starter spawns instances from.

Parameters

NameTypeDescription
actorApiIActor

Returns

AggregateFactory

Factory

this.Factory
Member
The factory the saga-starter spawns instances from, with an explicit policy.

Parameters

NameTypeDescription
actorApiIActor
snapshotPolicySnapshotPolicy

Returns

AggregateFactory

HandleEvent

this.HandleEvent
Member
Handles a message once the saga has a state: events from the aggregates it sends commands to, ExpectationExhausted, and the saga's own ToSelf messages.

Parameters

NameTypeDescription
arg0obj
arg1SagaState<'TData, 'TState>

Returns

EventAction<'TState>

Init

this.Init
Member
Register the saga; calling this IS the registration.

Parameters

NameTypeDescription
actorApiIActor

Returns

EntityFac<obj>

Init

this.Init
Member
Register the saga with an explicit (already-resolved) snapshot policy.

Parameters

NameTypeDescription
actorApiIActor
snapshotPolicySnapshotPolicy

Returns

EntityFac<obj>

Start

this.Start
Member
Handles a message that arrives before the saga has a state: normally the event that started it. Return StateChanged with the first state, or Unhandled.

Parameters

NameTypeDescription
arg0obj
arg1'TData

Returns

EventAction<'TState>

StartsOn

this.StartsOn
Member
Whether a stored originator event starts an instance of this saga.

Parameters

NameTypeDescription
arg0Event<'TEvent>

Returns

bool

Originator

this.Originator
Member
The aggregate whose stored event starts the saga, and the target of ToOriginator.

Returns

AggregateFactory

SnapshotPolicy

this.SnapshotPolicy
Member
Per-saga snapshot cadence. Override to use Every(n) or NoSnapshots; the default falls back to config:akka:persistence:snapshot-version-count (or 30).

Returns

SnapshotPolicy

SagaName

this.SagaName
Member
The saga's stored name, like an aggregate's EntityName. Changing it orphans stored sagas.

Returns

string

InitialData

this.InitialData
Member

Returns

'TData

NextState

Saga.NextState(next)
Member

Parameters

NameTypeDescription
next'TState

Returns

SagaTransition<'TState>

StateChanged

Saga.StateChanged(next)
Member
Transition and event DSL over TState.

Parameters

NameTypeDescription
next'TState

Returns

EventAction<'TState>

Stay

Saga.Stay()
Member

Returns

SagaTransition<'TState>

StopSaga

Saga.StopSaga()
Member

Returns

SagaTransition<'TState>

Unhandled

Saga.Unhandled()
Member

Returns

EventAction<'TState>